<admintpl file="header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
			<li><a href="{:U('Admin/Video/index')}">视频列表</a></li>
			<li><a href="{:U('Admin/Video/add')}">添加视频</a></li>
			<li class="active"><a>修改视频</a></li>
		</ul>
		<form method="post" class="form-horizontal js-ajax-form" enctype="multipart/form-data" action="{:U('Admin/Video/edit_post')}">
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">视频名称：</label>
					<div class="span5">
						<input type="text" name="name" value="{$name}">
					</div>
				</div>
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">是否VR：</label>
					<div class="span5">
						<select class="select_2" name="category">
							<option value="1" <if condition="$category eq 1"> selected </if>>否</option>
							<option value="2" <if condition="$category eq 2"> selected </if>>是</option>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">视频分类：</label>
					<div class="span5">
						<select class="select_2" id="typeId" name="typeId">
							<foreach name="types" item="vo">
								<option value="{$vo.typeId}" data-category="{$vo.category}">{$vo.name}</option>
							</foreach>
						</select>
					</div>
				</div>
				<div class="control-group">
					<label class="span2 control-label" style="width: 90px;">视频描述：</label>
					<div class="span7">
						<textarea style="width: 556px; height: 60px;" name="introduction">{$introduction}</textarea>
					</div>
				</div>
				
			<div class="form-actions" style="padding-left:260px;">
			    <input type="hidden" name="videoId" value="{$videoId}" />
				<button type="submit" class="btn btn-primary js-ajax-submit">保存</button>
				&nbsp;&nbsp;<a class="btn" href="{:U('Admin/Video/index')}">{:L('BACK')}</a>
			</div>
		</form>
	</div>
	<script src="__PUBLIC__/js/common.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/content_addtop.js"></script>
	<script type="text/javascript">
	$(document).ready(function(){
		function changeCategory(category, flag){
			if(1 == category){
				$('select option[data-category="2"]').css('display', 'none')
				$('select option[data-category="1"]').css('display', '')
			}else{
				$('select option[data-category="2"]').css('display', '')
				$('select option[data-category="1"]').css('display', 'none')
			}
			if(flag){
				$('#typeId').val(1);
			}
		}
		changeCategory({$category});
		$('select[name="category"]').change(function(){
			changeCategory($(this).val(), true);
		});
		
		$('#typeId').val({$typeId}, false);
	});
	</script>
</body>
</html>